package tech.aistar.day04;

import java.util.Arrays;

/**
 * 本类用来演示: java.util.Arrays数组工具类
 *
 * @author: success
 * @date: 2021/3/9 11:01 上午
 */
public class ArraysUtilDemo {
    public static void main(String[] args) {
        boolean[] flags = new boolean[10];

        Arrays.fill(flags,true);

//        for (int i = 0; i < flags.length; i++) {
//            System.out.println(flags[i]);
//        }

        System.out.println(Arrays.toString(flags));

        System.out.println("=====");
        int[] arr = {3,2,5,1,2};

        Arrays.sort(arr);

        System.out.println(Arrays.toString(arr));

        //注意的是 - 如果是字符串,则按照首字母进行排序
        String arr2[] = {"1","12","2","23"};
        //[1, 12, 2, 23]
        Arrays.sort(arr2);

        System.out.println(Arrays.toString(arr2));

        int[] arr3 = {1,2,3};
        int[] arr4 = {1,2,3};
        System.out.println(arr3 == arr4);//false
        System.out.println(Arrays.equals(arr3,arr4));//true

    }
}
